<template>
    <fieldset>
        <legend>子组件</legend>
        <h1>{{ msg }}</h1>输入框1:
        <input type="text" :value="msg1" @input="change" />
        <br />输入框2:
        <input type="text" :value="msg2" @input="change2" />
    </fieldset>
</template>
<script>
export default {
    props: ["msg1", "msg2"],
    data() {
        return {
            msg: "子组件"
        }
    },
    methods: {
        change(e) {
            // console.log(e.target.value)
            this.$emit("update:msg1", e.target.value)
        },
        change2(e) {
            this.$emit("update:msg2", e.target.value)
        }
    }
}
</script>